﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;

namespace C1WijmoProManagement
{
    public partial class _Default : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            if (this.Request.QueryString["theme"] != null)
            {
                ChangeTheme(this.Request.QueryString["theme"].ToString());
            }
            if (Session["curpage"] != null)
            {
                this.pagecontainer.Attributes["src"] = Session["curpage"].ToString();
                this.note.InnerHtml = Session["des"].ToString();
            }
        }

        private void ChangeTheme(string p)
        {
            string theme = "";
            switch (p)
            {
                case "1":
                    this.C1Menu1.Theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/blitzer/jquery-ui.css";
                    theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/blitzer/jquery-ui.css";
                    this.pagecontainer.Style.Value = "background-color:#FFFFFF";
                    break;
                case "4":
                    this.C1Menu1.Theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/dot-luv/jquery-ui.css";
                    theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/dot-luv/jquery-ui.css";
                    this.pagecontainer.Style.Value = "background-color:#9ccefc";
                    break;
                case "5":
                    this.C1Menu1.Theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/eggplant/jquery-ui.css";
                    theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/eggplant/jquery-ui.css";
                    this.pagecontainer.Style.Value = "background-color:#b7b5ba";
                    break;
                case "6":
                    this.C1Menu1.Theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/redmond/jquery-ui.css";
                    theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/redmond/jquery-ui.css";
                    this.pagecontainer.Style.Value = "background-color:#e6f3fd";
                    break;
                case "9":
                    this.C1Menu1.Theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/humanity/jquery-ui.css";
                    theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/humanity/jquery-ui.css";
                    this.pagecontainer.Style.Value = "background-color:#FFFFFF";
                    break;
                case "10":
                    this.C1Menu1.Theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/le-frog/jquery-ui.css";
                    theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/le-frog/jquery-ui.css";
                    this.pagecontainer.Style.Value = "background-color:#f4f0ec";
                    break;
                case "11":
                    this.C1Menu1.Theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/mint-choc/jquery-ui.css";
                    theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/mint-choc/jquery-ui.css";
                    this.pagecontainer.Style.Value = "background-color:#5d4d42";
                    break;
                case "22":
                    this.C1Menu1.Theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css";
                    theme = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css";
                    this.pagecontainer.Style.Value = "background-color:#feeebd";
                    break;
                case "23":
                    this.C1Menu1.Theme = "http://cdn.wijmo.com/themes/arctic/jquery-wijmo.css";
                    theme = "http://cdn.wijmo.com/themes/arctic/jquery-wijmo.css";
                    this.pagecontainer.Style.Value = "background-color:#FFFFFF";
                    break;
                case "24":
                    this.C1Menu1.Theme = "http://cdn.wijmo.com/themes/aristo/jquery-wijmo.css";
                    theme = "http://cdn.wijmo.com/themes/aristo/jquery-wijmo.css";
                    this.pagecontainer.Style.Value = "background-color:#dfdee2";
                    break;
                case "25":
                    this.C1Menu1.Theme = "http://cdn.wijmo.com/themes/rocket/jquery-wijmo.css";
                    theme = "http://cdn.wijmo.com/themes/rocket/jquery-wijmo.css";
                    this.pagecontainer.Style.Value = "background-color:#f1f1f1";
                    break;
                case "26":
                    this.C1Menu1.Theme = "http://cdn.wijmo.com/themes/midnight/jquery-wijmo.css";
                    theme = "http://cdn.wijmo.com/themes/midnight/jquery-wijmo.css";
                    this.pagecontainer.Style.Value = "background-color:#44444e";
                    break;
                case "27":
                    this.C1Menu1.Theme = "http://cdn.wijmo.com/themes/sterling/jquery-wijmo.css";
                    theme = "http://cdn.wijmo.com/themes/sterling/jquery-wijmo.css";
                    this.pagecontainer.Style.Value = "background-color:#FCFDF6";
                    break;
                case "28":
                    this.C1Menu1.Theme = "http://cdn.wijmo.com/themes/cobalt/jquery-wijmo.css";
                    theme = "http://cdn.wijmo.com/themes/cobalt/jquery-wijmo.css";
                    this.pagecontainer.Style.Value = "background-color:#dae6f4";
                    break;
                default:
                    break;
            }
            Session["theme"] = theme;
        }

        protected void C1Menu1_ItemClick(object sender, C1.Web.Wijmo.Controls.C1Menu.C1MenuEventArgs e)
        {
            switch (e.Item.Text)
            {
                case "首页":
                    this.pagecontainer.Attributes["src"] = "overview.aspx";
                    this.note.InnerHtml = "拥有40多个不同风格的高性能且易用的控件，基于常用的Web标准:AJAX, CSS，HTML5和jQuery。这些控件都可作为ASP.NET控件、扩展和MVC工具使用。";
                    Session["curpage"] = "overview.aspx";
                    Session["des"] = "拥有40多个不同风格的高性能且易用的控件，基于常用的Web标准:AJAX, CSS，HTML5和jQuery。这些控件都可作为ASP.NET控件、扩展和MVC工具使用。";
                    break;
                case "录入":
                    this.pagecontainer.Attributes["src"] = "adddata.aspx";
                    this.note.InnerHtml = "数据输入控件和数据验证控件的完美集合: 可以选择掩码、日期、数字和自定义编辑等格式来显示数据。";
                    Session["curpage"] = "adddata.aspx";
                    Session["des"] = "数据输入控件和数据验证控件的完美集合: 可以选择掩码、日期、数字和自定义编辑等格式来显示数据。";
                    break;
                case "报表":
                    this.pagecontainer.Attributes["src"] = "report.aspx";
                    this.note.InnerHtml = "在几分钟内将能够您的数据转换为强大的、可打印的、能连接网络的报表。";
                    Session["curpage"] = "report.aspx";
                    Session["des"] = "在几分钟内将能够您的数据转换为强大的、可打印的、能连接网络的报表。";
                    break;
                case "订单":
                    this.pagecontainer.Attributes["src"] = "gridview.aspx";
                    this.note.InnerHtml = "从一个数据源中显示项目，该控件具有交互式、完全可定制的特性。并且可以交互式选择、编辑、删除、排序和分组数据。";
                    Session["curpage"] = "gridview.aspx";
                    Session["des"] = "从一个数据源中显示项目，该控件具有交互式、完全可定制的特性。并且可以交互式选择、编辑、删除、排序和分组数据。";
                    break;
                case "图表":
                    this.pagecontainer.Attributes["src"] = "chart.aspx";
                    this.note.InnerHtml = "只需一个图表就可以对复杂数据进行分析。相同数据使用不同的方式进行显示，再将与之关联的数据进行叠加，便可预测数据的走势。";
                    Session["curpage"] = "chart.aspx";
                    Session["des"] = "只需一个图表就可以对复杂数据进行分析。相同数据使用不同的方式进行显示，再将与之关联的数据进行叠加，便可预测数据的走势。";
                    break;
                default:
                    break;
            }
        }

        protected void C1Menu1_SelectedIndexChanged(object sender, C1.Web.Wijmo.Controls.C1ComboBox.C1ComboBoxEventArgs args)
        {
            ChangeTheme(args.NewSelectedIndex);
        }

        private void ChangeTheme(int index)
        {
            this.C1Menu1.Theme = this.C1Menu1.Items[index].Value;
            this.C1Menu1.Theme = this.C1Menu1.Items[index].Value;
            Session["theme"] = this.C1Menu1.Theme;
        }
    }
}